<?php use_helper("i18n")?>
<?php $culture = $sf_user->getCulture()?>
<?php /*
<div id="box-weather">
<?php if( $sf_params->get('module') == 'home' && $sf_params->get('action') == 'index' ) :?>
<div class="h-txt-white">กรุงเทพมหานคร</div>
<?php endif;?>
<div id="sel-right">
<select id="region"></select>
<select id="province"></select>
</div>
<?php
$regionIndex = $sf_params->get("regionIndex")? $sf_params->get("regionIndex"): 3;
$regionId = $sf_params->get("regionId")? $sf_params->get( "regionId" ): 3;
$provinceId = $sf_params->get("provinceId")? $sf_params->get("provinceId"): 37;
?>
<?php include_component( "weatherProvince" , "provinceWeatherBox", array( "provinceId"=> $provinceId, "regionIndex" => $regionIndex, "regionId"=> $regionId ) )?>
</div>
*/?>
<div id="box-weather-province">
    <div class="h-txt-white"><?php echo __("7-day Forecast")?> <?php echo TMDService::renderI18n( $province, "getSname", $culture )?></div>
    <div id="sel-right">
		<select id="region"></select>
		<select id="province"></select>
	</div>
    <div id="bg-weather">
    	<?php if( isset( $forecasts ) && count( $forecasts ) > 0 ) :?>
	    	<?php foreach( $forecasts as $forecast ):?>
		        <?php //$forecast = new Input7dForecastProvince()?>
		        <?php $type = $weatherTypes[$forecast->getIweatherType()]?>
		        <?php $isCurrentDate = $forecast->getDttimeForecast( 'w' ) == date('w', TMDService::findCurrentAsTime() )?>
		        <div class="box-day<?php echo $isCurrentDate? ' active' : ''?>">
		            <div class="txt-head">
			            <?php if( $isCurrentDate ):?>
			            	<?php echo __("Today")#วันนี้?>
			            <?php else:?>
			            	<?php echo __( $forecast->getDttimeForecast( 'l' ) )?>
			            <?php endif;?>
		            </div>
		            <div class="txt-dte"><?php echo $forecast->getDttimeForecast( 'd/m' )?>/<?php echo TMDService::renderI18nYear( $forecast->getDttimeForecast( 'Y' ), $culture )?></div>
		            <div class="img">
		                <img width="48" height="48" src="<?php echo image_path("/images/icon/weather/weather" . $forecast->getIweatherType() . ".png")?>" />
		            </div>
		            <div class="txt-white"><?php echo sprintf("%d℃ | %d℃", $forecast->getItemperatureMin(), $forecast->getItemperatureMax() )?></div>
		            <div class="txt-detail">
		                <?php echo TMDService::renderI18n( $type, "getSdesc", $culture )?><br>
		                <?php echo __("%1% precip coverage", array( '%1%' => $forecast->getIrainArea() . '%' ))#ฝน 60% ของพื้นที่?>
		            </div>
		        </div>
        	<?php endforeach;?>
        <?php endif;?>
    </div>
</div>
